package com.usabb.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import org.springframework.stereotype.Service;

import com.usabb.dao.CombosItemValueDao;
import com.usabb.domain.CombosItemValueDO;
import com.usabb.service.CombosItemValueService;
import com.ifast.common.base.CoreServiceImpl;

import java.util.List;

/**
 * 
 * <pre>
 * 套餐条目表
 * </pre>
 * <small> 2019-10-05 10:25:25 | Jory</small>
 */
@Service
public class CombosItemValueServiceImpl extends CoreServiceImpl<CombosItemValueDao, CombosItemValueDO> implements CombosItemValueService {

    @Override
    public List<CombosItemValueDO> getByCombosId(Long combosId) {
        Wrapper<CombosItemValueDO> wrapper = ofCombosIdWrapper(combosId);

        return this.selectList(wrapper);
    }

    @Override
    public boolean deleteByCombosId(Long combosId) {
        Wrapper<CombosItemValueDO> wrapper = ofCombosIdWrapper(combosId);

        return this.delete(wrapper);
    }

    private static Wrapper ofCombosIdWrapper(Long combosId) {
        CombosItemValueDO param = new CombosItemValueDO();
        param.setCombosId(combosId);
        return new EntityWrapper<>(param);
    }
}
